/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package main;

import com.jme3.input.InputManager;
import com.jme3.input.KeyInput;
//import com.jme3.input.controls.ActionListener;
import com.jme3.input.controls.AnalogListener;
import com.jme3.input.controls.KeyTrigger;
import controller.NinjaController;
import model.Ninja;

/**
 *
 * @author Peter
 */
public class Controller {
    
   public static final String PLAYER_TURN_LEFT = "PlayerTurnLeft";
   public static final String PLAYER_TURN_RIGHT = "PlayerTurnRight";
   public static final String PLAYER_WALK_FORWARD = "PlayerWalkForward";
   public static final String PLAYER_BACKFLIP = "PlayerBackFlip";
   
   
  public Controller(InputManager inputManager, Main app, float speed){
    //inputManager.addMapping("Pause",  new KeyTrigger(KeyInput.KEY_P));
    inputManager.addMapping(PLAYER_TURN_LEFT,   new KeyTrigger(KeyInput.KEY_J));
    inputManager.addMapping(PLAYER_TURN_RIGHT,  new KeyTrigger(KeyInput.KEY_K));
    inputManager.addMapping(PLAYER_WALK_FORWARD, new KeyTrigger(KeyInput.KEY_SPACE));
    inputManager.addMapping(PLAYER_BACKFLIP, new KeyTrigger(KeyInput.KEY_L));

    NinjaController ninjaController = new NinjaController(new Ninja(), app, speed);
    //inputManager.addListener(actionListener, new String[]{"Pause"});
    inputManager.addListener(ninjaController, new String[]{
        PLAYER_TURN_LEFT,
        PLAYER_TURN_RIGHT,
        PLAYER_WALK_FORWARD,
        PLAYER_BACKFLIP});
 
  }
 
//  private ActionListener actionListener = new ActionListener() {
//    public void onAction(String name, boolean keyPressed, float tpf) {
//      if (name.equals("Pause") && !keyPressed) {
//        // do nothing
//      }
//    }
//  };
    
}
